home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 for Intel / NeXTSTEP 3.2 for Intel.iso / NextLibrary / Documentation / Sybase / DBLIB / Section2 / dbnumrets.nr < prev    next >
Encoding:
Text File  |  1993-04-22  |  3.0 KB  |  86 lines

  1. .Na "dbnumrets" 
  2. .mc |
  3. .Aa
  4. .Fu
  5. Determine the number of return parameter values generated by a stored procedure.
  6. .Ih "stored procedure, return parameters"
  7. .Ih "return parameters from stored procedures"
  8. .Sy
  9. .Sf "int dbnumrets(dbproc)"
  10. .Sp "DBPROCESS" "*dbproc"
  11. .Co
  12. .Bl
  13. \f2dbnumrets()\f1 provides the number of return parameter values 
  14. returned by the most recent EXECUTE statement or remote procedure call on a stored procedure.
  15. .Bl
  16. \*N stored procedures can return values for specified ``return parameters.''
  17. Changes made to the value of a return parameter inside the stored procedure
  18. are then available to the program that called the procedure.
  19. This is analogous to the ``pass by reference'' facility available in some
  20. programming languages.
  21. .sp 0.5v
  22. For a parameter to function as a return parameter,
  23. it must be declared as such within the stored procedure.
  24. The EXECUTE statement or remote procedure call 
  25. that calls the stored procedure must also indicate that the parameter should function
  26. as a return parameter.
  27. In the case of a remote procedure call, it is the \f2dbrpcparam()\f1 routine that specifies whether
  28. a parameter is a return parameter.
  29. .Bl
  30. When executing a stored procedure,
  31. the server returns any parameter values immediately after returning all other results.
  32. Therefore, the application can call \f2dbnumrets()\f1 only after 
  33. processing the stored procedure's results by calling 
  34. \f2dbresults()\f1, as well as \f2dbnextrow()\f1 if appropriate.
  35. (Note that a stored procedure can generate several sets of results\(emone for each SELECT
  36. it contains.
  37. Before the application can call \f2dbnumrets()\f1 or any other routines that
  38. process return parameters, it
  39. must call \f2dbresults()\f1 and \f2dbnextrow()\f1 as many times as necessary
  40. to process all the results.)
  41. .Bl
  42. If the stored procedure is invoked with a remote procedure call,
  43. the return parameter values are automatically available to the application.
  44. If, on the other hand,
  45. the stored procedure is invoked with an EXECUTE statement, 
  46. the return parameter values are available only if the command batch 
  47. containing the EXECUTE statement uses
  48. local variables, not constants, for the return parameters.
  49. .Bl
  50. Other routines return additional information about return parameter values:
  51. .in +3n
  52. .Bl *
  53. \f2dbretdata()\f1 returns a pointer to a parameter value.
  54. .Bl *
  55. \f2dbretlen()\f1 returns the length of a parameter value.
  56. .Bl *
  57. \f2dbretname()\f1 returns the name of a parameter value.
  58. .Bl *
  59. \f2dbrettype()\f1 returns the datatype of a parameter value.
  60. .in -3n
  61. .Bl
  62. For an example of this routine,
  63. see Example 8 in the \f2\*L Reference Supplement\f1.
  64. .Bz
  65. .Pa
  66. .Pi dbproc
  67. A pointer to the DBPROCESS structure that provides the connection
  68. for a particular front-end/\*S process.  It contains all the
  69. information that \*L uses to manage communications and data between the
  70. front end and \*S.
  71. .in -.375i
  72. .Re
  73. .br
  74. The number of return parameter values associated with the most recently-executed
  75. stored procedure.
  76. .Sa
  77. dbnextrow,
  78. dbresults,
  79. dbretdata, 
  80. dbretlen, 
  81. dbretname,
  82. dbrettype,
  83. dbrpcinit,
  84. dbrpcparam
  85. .mc
  86.